#ifndef MONITORPRO_SKYWALKING_CLIENT_H
#define MONITORPRO_SKYWALKING_CLIENT_H

#include "php_monitorpro.h"
#include "segment.h"
#include "tcp_client.h"

#include <string>
#include <vector>

class SkywalkingClient
{
private:
    int sockfd;
    std::string host;
    std::string port;
    std::string uri;
    std::vector<std::string> msg;
    int queueSize = 0;
    bool status = false;
    Segment *seg = nullptr;
    TCPClient *tcp = nullptr;

public:
    static SkywalkingClient *instance;

private:
    SkywalkingClient(){};

public:
    static SkywalkingClient *newInstance();
    static void conn();
    static void sendMsg(bool enable);

    void init();
    void run();
    bool isEmpty();
    void push(std::string data);
    std::string pop();
    std::string getHost();
    std::string getPort();
    std::string getUri();
    int getSockFd();
    Segment *getSegment();
    TCPClient *getTcp();
    void setHost(std::string host);
    void setPort(std::string port);
    void setUri(std::string uri);
    void setSockFd(int fd);
    void setQueueSize(int size);
    void delSeg();
    void delTcp();
    bool isEmptyTcp();
    void clean();
};

#endif